package com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.config;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.entity.SmsWnsSchoolFeesDelayProcess;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.mapper.SmsWnsSchoolFeesDelayProcessMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class SchoolFeesDelayInit {

    @Resource
    private SmsWnsSchoolFeesDelayProcessMapper smsWnsSchoolFeesDelayProcessMapper;

    private String[] departmentNameArray = {"辅导员","招生办","二级学院", "财务处", "院领导"};

    @Bean
    public void schoolFeesInit() {
        List<SmsWnsSchoolFeesDelayProcess> processList =
                smsWnsSchoolFeesDelayProcessMapper.selectList(new QueryWrapper<>());
        if (processList == null || processList.size() < 1) {
            int sort = 1;
            for (String departmentName : departmentNameArray) {
                SmsWnsSchoolFeesDelayProcess addProcess = new SmsWnsSchoolFeesDelayProcess();
                addProcess.setProcessName(departmentName);
                addProcess.setProcessIsUse(true);
                addProcess.setProcessIsStamp(false);
                addProcess.setProcessIsSign(true);
                addProcess.setProcessIsApplicationEdit(false);
                addProcess.setProcessSort(sort++);
                smsWnsSchoolFeesDelayProcessMapper.insert(addProcess);
            }


        }
    }
}
